#include "ScrambledItem.h"
#include "Game.h"
#include "StringLib.h"
#include "Util.h"

ScrambledItem::ScrambledItem(GenericType type, TypeHierarchy scrambledCategory, int scrambledType) : Item(type) {
	m_scrambledCategory = scrambledCategory;
	m_scrambledType = scrambledType;
}

ScrambledItem::ScrambledItem(GenericType type, std::ifstream& file) : Item(type, file) {
}

ScrambledItem::~ScrambledItem() {
}

void ScrambledItem::load(TypeHierarchy scrambledCategory, int scrambledType) {
	m_scrambledCategory = scrambledCategory;
	m_scrambledType = scrambledType;
}

void ScrambledItem::save(std::ofstream& file) const {
	Item::save(file);
}

std::string ScrambledItem::getItemName(int mod) const {
	int numStacked = m_numStacked - mod;
	std::string output = "";
	if(m_statusIdentified)
		output += g_stringLib->getMiscString(MST_STATUS, m_status) + " ";

	if(isIdentified())
		output += numStacked > 1 ? getPluralName() : GameObject::getBasicName();
	else
		output += numStacked > 1 ? g_stringLib->getObjectString(m_scrambledCategory, m_scrambledType, 5) : g_stringLib->getObjectString(m_scrambledCategory, m_scrambledType, 3);
	if(numStacked > 1)
		output = Util::intToString(numStacked) + " " + output;
	return output;
}

std::string ScrambledItem::getDescription() const {
	if(isIdentified())
		return Item::getDescription();
	else
		return g_stringLib->getObjectString(m_scrambledCategory, m_scrambledType, 4);
}